package com.keshihao.springcloud.mapper;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.security.crypto.bcrypt.BCrypt;
import org.springframework.test.context.junit4.SpringRunner;

/**
 * @author Mr.Ke
 * @create 2020-10-18-22:24
 */
    @RunWith(SpringRunner.class)
    public class Test1 {
    @Test
    public void test1(){ //对原始密码加密
            String hashpw = BCrypt.hashpw("123456",BCrypt.gensalt());
            System.out.println(hashpw); //校验原始密码和BCrypt密码是否一致
            boolean checkpw = BCrypt.checkpw("123456", "$2a$10$NlBC84MVb7F95EXYTXwLneXgCca6/GipyWR5NHm8K0203bSQMLpvm");
            System.out.println(checkpw); }
    }
